//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.qst.crop.service.impl;

import com.qst.crop.dao.SellPurchaseDao;
import com.qst.crop.entity.SellPurchase;
import com.qst.crop.service.SellPurchaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SellPurchaseServiceImpl implements SellPurchaseService {
    @Autowired
    private SellPurchaseDao sellPurchaseDao;

    public SellPurchaseServiceImpl() {
    }

    public void add(SellPurchase sellPurchase) {
        this.sellPurchaseDao.insertSelective(sellPurchase);
    }

    public List<SellPurchase> selectByName() {
        UserDetails principal = (UserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        String name = principal.getUsername();
        return this.sellPurchaseDao.selectByName(name);
    }
}
